<%--
  Created by IntelliJ IDEA.
  User: 晓东√
  Date: 2024/6/3 0003
  Time: 11:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>员工每日打卡信息</title>
    <script src="${pageContext.request.contextPath}/js/jquery-1.11.3.js"></script>
    <style>
        table{
            background-color: #a5cbcc;
        }


    </style>
</head>
<body>
<div class="container-fluid">
    <table class="table table-dark">
        <thead>
        <tr>
            <th scope="col">日期</th>
            <th scope="col">星期</th>
            <th scope="col">开始打卡时间</th>
            <th scope="col">结束打卡时间</th>
            <th scope="col">打卡状态</th>
        </tr>
        </thead>
        <tbody>

        </tbody>
    </table>
</div>
</body>
</html>
<script>
    $.ajax({
        url: '${pageContext.request.contextPath}/statistics.action',
        type: 'get',
        data: {opr: 'yg'},
        dataType: 'json',
        success: callBackList,
        error: function () {
            alert("查询失败！请联系管理员")
        }
    })

    function callBackList(data) {
        console.log(data)
        //清空tbody
        $('tbody').empty();
        data.forEach(dd => {
            let tr = $(`<tr>
                        <td>` + dd.date + `</td>
                        <td>` + dd.dayType + `</td>
                        <td>` + dd.startTime + `</td>
                        <td>` + dd.endTime + `</td>
                        <td>` + dd.attendance_status + `</td>
                    </tr>`)
            $('tbody').append(tr)

        })
    }
</script>
